package com.example.vspm.service.impl;

import com.example.vspm.entity.MeetingPlace;
import com.example.vspm.entity.TaskForm;
import com.example.vspm.mapper.MeetingPlaceMapper;
import com.example.vspm.service.MeetingPlaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author LCL
 * @date 2022/3/10
 * @desc
 */
@Service
public class MeetingPlaceImpl implements MeetingPlaceService {
    @Autowired
    MeetingPlaceMapper meetingPlaceMapper;
    @Autowired
    HttpServletRequest request;//通过注解获取一个request,获取session

    //添加会场
    public void addMeetingPlace(MeetingPlace meetingPlace) {
        meetingPlaceMapper.addMeetingPlace(meetingPlace);
//        //往会场表里添加工单taid
//        Object object1 = request.getSession().getAttribute("addTaskForm");
//        TaskForm taskForm1 = (TaskForm) object1;
//        System.out.println("这是存放在session的工单id,准备加到会场中"+taskForm1.getTid());
//        //添加taid
//        addTaskFormTaid(taskForm1.getTid(),meetingPlace.getTid());
//        System.out.println(meetingPlace.getTid()+"---这是会场的id");
    }

//    //添加会场的工单的taid
//    public void addTaskFormTaid(int taid, int tid) {
//        meetingPlaceMapper.addTaskFormTaid(taid,tid);
//    }


   //根据工单id查看对应的会场信息
    @Override
    public List<MeetingPlace> listMeetingPlaceByTaid(int taid) {
        return meetingPlaceMapper.listMeetingPlaceByTaid(taid);
    }
    //根据工单taid获取对应的会场id
    public int getId(int taid){
        return meetingPlaceMapper.getId(taid);
    };


//    //查看会场
//    public List<MeetingPlace> listMeetingPlace() {
//        return meetingPlaceMapper.listMeetingPlace();
//    }


}
